import React from 'react';
// import { Icon } from 'antd';
import { RegisterNode } from 'gg-editor';
import End from './img/end2.svg';

class CustomNode extends React.Component {
  render() {
    const config = {
      draw(item) {
        const keyShape = this.drawKeyShape(item);

        // 绘制图标
        const group = item.getGraphicGroup();
        const model = item.getModel();

        group.addShape('image', {
          attrs: {
            x: -12,
            y: -12,
            width: 24,
            height: 24,
            img: End,
          },
        });

        // 绘制标签
        this.drawLabel(item);

        return keyShape;
      },

      anchor: [
        [0.5, 0], // 上边中点
        [0.5, 1], // 底边中点
        [1, 0.5], // 上边中点
        [0, 0.5],
      ],
    };

    return <RegisterNode name="custom-end" config={config} extend={'flow-circle'} />;
  }
}

export default CustomNode;
